#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;

  cin >> n >> m;
  vector<vector<int>> a(n + 1, vector<int>(m + 1, 0));

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }

  int max_area = 0;

  for (int i = 1; i <= n; i++) {
    vector<int> suma(m + 1, 0);
    for (int k = i; k <= n; k++) {
      for (int j = 1; j <= m; j++) {
        suma[j] += a[k][j];
      }

      if ((k - i + 1) * m <= max_area) {
        continue;
      }
      stack<int> sta;
      vector<int> sum = suma;

      sta.push(0);
      for (int j = 1; j <= m; j++) {
        sum[j] += sum[j - 1];
        if (sum[sta.top()] > sum[j]) {
          sta.push(j);
        }
      }
      for (int j = m; j >= 1; j--) {
        while (!sta.empty() && sum[sta.top()] <= sum[j]) {
          max_area = max(max_area, (k - i + 1) * (j - sta.top()));
          sta.pop();
        }
      }
    }
  }
  cout << max_area << "\n";
  return 0;
}